<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[#include "/admin/include/head.htm"]
    <script>



        var grid;
        $(function(){
            grid = $("#maingrid").ligerGrid({
                columns: [

                    {display: '用户ID', name: 'id', align: 'center', width: 100,frezen:"true" },
                    {display: '链接', name: 'img_link', align: 'center', width: 150 },
                    {display: '状态', name: 'is_display', align: 'center', width: 200,
                        render: function(row){
                            if(row.is_display==1){
                                return "开启";
                            }else{
                                return "关闭";
                            }
                        }
                    },
                    {display: '种类', name: 'category', align: 'center', width: 200,
                        render: function(row){
                            if(row.category==1){
                                return "公告";
                            }else  if(row.category==2){
                                return "移动端";
                            }
                        }
                    },
                    {display: '图片说明', name: 'explanation', align: 'center', width: 100 },
                    {display: '添加人', name: 'add_person', align: 'center', width: 100 },
                    {display: '修改',  align: 'center', width: 100,
                        render: function(row){
                            var html = '<input value="修改" style="cursor:pointer" type="button" onclick=f_add('+row.id+')>';
                            return html;
                        }
                    },
                    {display: '删除',  align: 'center', width: 100,
                        render: function(row){
                            var html = '<input value="删除" style="cursor:pointer" type="button" onclick=f_deleteEmp('+row.id+')>';
                            return html;
                        }
                    }
                ],  pageSize:20, url: 'queryData.aspx',toolbar: {}, width: '100%', height:'100%', enabledSort: true
            });

            //绑定搜索按钮
            LG.search(grid);
            $(".l-toolbar").ligerToolBar({ items: [
                { text: '增加', click: f_add1 }
            ]
            });

        });

        function f_add1(){
            window.location.href='${path}/admin/advert/add.aspx';
        }

        function f_add(id){

            window.location.href='${path}/admin/advert/add.aspx?id='+id;
        }
        function f_deleteEmp(id){
            LG.ajax({
                url: base + '/admin/advert/delete.aspx',
                loading: '删除中...',
                data: { id: id  },
                success: function () {
                    LG.showSuccess('操作成功!');
                    f_reload();
                },
                error: function (message) {
                    LG.showError(message);
                }
            });
        }


    </script>
</head>

<body style="overflow:hidden;padding:10px;">
<div id="functions">
    <div class="clearfix">
        <div style="float:left;">

        </div>
    </div>
</div>

<div id="maingrid" style="margin:0; padding:0"></div>
</body>

</html>